45 TrajectoryBaseWPtr trajectory_ptr_;
46 CaptureBasePtrList capture_list_;
48 static unsigned int frame_id_count_;
72 template <
typename classType,
typename... T>
73 static std::shared_ptr<classType>
emplace(TrajectoryBasePtr _ptr, T&&... all);
77 void link(TrajectoryBasePtr);
81 void link(ProblemPtr _prb);
83 void remove(
bool viral_remove_parent_without_children =
false)
override;
88 unsigned int id()
const override;
108 StateBlockConstPtr
getV()
const;
112 StateBlockPtr
getV();
115 void setProblem(ProblemPtr _problem)
override final;
133 FrameBaseConstPtr
getNextFrame(
const unsigned int& i = 1)
const;
153 bool hasCapture(
const CaptureBaseConstPtr& _capture)
const;
209 CaptureBaseConstPtr
getCaptureOf(SensorBaseConstPtr _sensor_ptr)
const;
213 CaptureBasePtr
getCaptureOf(SensorBaseConstPtr _sensor_ptr);
217 CaptureBaseConstPtr
getCaptureOf(SensorBaseConstPtr _sensor_ptr,
const std::string& type)
const;
221 CaptureBasePtr
getCaptureOf(SensorBasePtr _sensor_ptr,
const std::string& type);
225 CaptureBaseConstPtrList
getCapturesOf(SensorBaseConstPtr _sensor_ptr)
const;
238 std::ostream& stream,
239 std::string _tabs =
"")
const;
243 void print(
int depth,
247 std::ostream& stream = std::cout,
248 std::string _tabs =
"")
const;
252 virtual CheckLog localCheck(
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
256 bool check(
CheckLog& _log,
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
261 CaptureBasePtr addCapture(CaptureBasePtr _capt_ptr);
265 void removeCapture(CaptureBasePtr _capt_ptr);
269 void setTrajectory(TrajectoryBasePtr _trj_ptr);
276 return std::static_pointer_cast<FrameBase>(shared_from_this());
283 return std::static_pointer_cast<const FrameBase>(shared_from_this());
298template <
typename classType,
typename... T>
301 std::shared_ptr<classType> frm = std::make_shared<classType>(std::forward<T>(all)...);
302 frm->emplacePriors();
334 return trajectory_ptr_.lock();
339 return trajectory_ptr_.lock();
344 CaptureBaseConstPtrList list_const;
345 for (
auto&& obj_ptr : capture_list_) list_const.push_back(obj_ptr);
351 return capture_list_;
354inline void FrameBase::setTrajectory(TrajectoryBasePtr _trj_ptr)
356 trajectory_ptr_ = _trj_ptr;
364 auto cap_derived = std::dynamic_pointer_cast<const C>(capture_ptr);
365 if (cap_derived)
return cap_derived;
375 auto cap_derived = std::dynamic_pointer_cast<C>(capture_ptr);
376 if (cap_derived)
return cap_derived;
384 std::list<std::shared_ptr<const C>> captures;
387 auto cap_derived = std::dynamic_pointer_cast<const C>(capture_ptr);
388 if (cap_derived) captures.push_back(cap_derived);
396 std::list<std::shared_ptr<C>> captures;
399 auto cap_derived = std::dynamic_pointer_cast<C>(capture_ptr);
400 if (cap_derived) captures.push_back(cap_derived);
Base class of captures: a sensor measurement taken at a time stamp, linked to a frame,...
Definition: capture_base.h:41
Log of a consistency check: whether it is consistent and the explanation of the inconsistencies.
Definition: check_log.h:30
Base class of factors: a constraint between state blocks of one or more nodes, given a measurement an...
Definition: factor_base.h:73
Base class of frames: the states of the robot at a time stamp, in the trajectory, with the captures t...
Definition: frame_base.h:40
virtual void printHeader(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
Prints the information of this node (not of its children)
Definition: frame_base.cpp:267
CaptureBaseConstPtrList getCapturesOf(SensorBaseConstPtr _sensor_ptr) const
Returns the captures of a sensor.
Definition: frame_base.cpp:194
virtual CheckLog localCheck(bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node (not of its children)
Definition: frame_base.cpp:300
~FrameBase() override=default
bool hasCapture(const CaptureBaseConstPtr &_capture) const
Returns whether the capture belongs to the frame.
Definition: frame_base.cpp:236
TimeStamp getTimeStamp() const
Returns the time stamp.
Definition: frame_base.h:317
unsigned int id() const override
Returns the id of the node, unique among the nodes of its category.
Definition: frame_base.h:307
FactorBaseConstPtrList getFactorList() const
Returns the factors of all the captures of the frame.
Definition: frame_base.cpp:210
void setTimeStamp(const TimeStamp &_ts)
Sets the time stamp.
Definition: frame_base.cpp:78
FrameBaseConstPtr getPreviousFrame(const unsigned int &i=1) const
Returns the i-th previous frame in the trajectory (nullptr if none)
Definition: frame_base.cpp:90
unsigned int frame_id_
Frame id, unique among frames.
Definition: frame_base.h:51
FrameBaseConstPtr shared_from_this_frame() const
Returns a shared pointer to this frame.
Definition: frame_base.h:281
bool check(CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node and its children, composing the log.
Definition: frame_base.cpp:342
std::list< std::shared_ptr< const C > > getCapturesOfType() const
Returns the captures of class C.
Definition: frame_base.h:382
TimeStamp time_stamp_
Frame time stamp.
Definition: frame_base.h:52
CaptureBaseConstPtrList getCaptureList() const
Returns the captures of the frame.
Definition: frame_base.h:342
std::shared_ptr< const C > getCaptureOfType() const
Returns the first capture of class C (nullptr if none)
Definition: frame_base.h:360
TrajectoryBaseConstPtr getTrajectory() const
Returns the trajectory the frame belongs to.
Definition: frame_base.h:332
void link(TrajectoryBasePtr)
Links the frame to a trajectory.
Definition: frame_base.cpp:241
void remove(bool viral_remove_parent_without_children=false) override
Removes the node: its state blocks and the factors constraining them.
Definition: frame_base.cpp:44
FrameBasePtr shared_from_this_frame()
Returns a shared pointer to this frame.
Definition: frame_base.h:274
void print(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
Prints this node and, depending on the depth, its children.
Definition: frame_base.cpp:287
FrameBase(const TimeStamp &_ts, const TypeComposite &_frame_types, const VectorComposite &_frame_vectors, const PriorComposite &_frame_priors={})
Constructor from a time stamp and the state specs (types, vectors, priors)
Definition: frame_base.cpp:32
StateBlockConstPtr getV() const
Returns the state block of key 'V' (nullptr if none)
Definition: frame_base.h:322
FrameBaseConstPtr getNextFrame(const unsigned int &i=1) const
Returns the i-th next frame in the trajectory (nullptr if none)
Definition: frame_base.cpp:104
void setProblem(ProblemPtr _problem) override final
Sets the problem (if not set yet) and notifies it of all the state blocks and prior factors.
Definition: frame_base.cpp:258
CaptureBaseConstPtr getCaptureOf(SensorBaseConstPtr _sensor_ptr) const
Returns the first capture of a sensor (nullptr if none)
Definition: frame_base.cpp:178
static std::shared_ptr< classType > emplace(TrajectoryBasePtr _ptr, T &&... all)
Creates a frame of class classType, emplaces its priors and links it to the trajectory.
Definition: frame_base.h:299
bool hasChildren() const override
Returns whether the node has children in the Wolf tree.
Definition: frame_base.cpp:73
Base class of the nodes having state blocks (sensors, frames, captures and landmarks)
Definition: node_state_blocks.h:36
virtual StateBlockConstPtr getStateBlock(const char &_sb_key) const
Returns the state block of a key (nullptr if none)
Definition: node_state_blocks.h:433
TimeStamp implements basic functionalities for time stamps.
Definition: time_stamp.h:39
Composite of state vectors.
Definition: vector_composite.h:29
Definition: capture_base.h:23